CopyTo Method

Task Parallel System.Threading

Copies all of the items in the BlockingCollection<(Of <(T>)>) instance to a compatible one-dimensional array, starting at the specified index of the target array.

Namespace:  System.Collections.Concurrent
Assembly:  System.Threading (in System.Threading.dll)

Syntax

Visual Basic (Declaration)
Public Sub CopyTo ( _
	array As T(), _
	index As Integer _
)
C#
public void CopyTo(
	T[] array,
	int index
)

Parameters

array
Type: array< T >[]()[]
The one-dimensional array that is the destination of the elements copied from the BlockingCollection<(Of <(T>)>) instance. The array must have zero-based indexing.
index
Type: System..::.Int32
The zero-based index in array at which copying begins.

Exceptions

ExceptionCondition
System..::.ArgumentNullExceptionThe array argument is null.
System..::.ArgumentOutOfRangeExceptionThe index argument is less than zero.
System..::.ArgumentExceptionThe index argument is equal to or greater than the length of the array.
System..::.ObjectDisposedExceptionThe BlockingCollection<(Of <(T>)>) has been disposed.

See Also